package com.yixun.qfbao.exception;




import com.yixun.common.exception.YIXUNExceptionCode;
import com.yixun.common.exception.YIXUNUNCheckedException;
import com.yixun.qfbao.exception.enums.ExceptionCodeEnum;


public class YXUNCheckedException extends YIXUNUNCheckedException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6909100912893374110L;
	
	private String code;

	public String getOutMsg(){
		ExceptionCodeEnum mcode = ExceptionCodeEnum.getByCode(code);
		if(mcode!=null){
			return mcode.getDesout();
		}
		return getMessage();
	}
	
	public String getInMsg(){
		ExceptionCodeEnum mcode = ExceptionCodeEnum.getByCode(code);
		if(mcode!=null){
			return mcode.getDesin();
		}
		return getMessage();
	}
	public YXUNCheckedException() {
		super();
	}

	public YXUNCheckedException(Throwable e) {
		super(e);
	}

	public YXUNCheckedException(String errorCode) {
		super();
		this.code = errorCode;
	}

	
	public YXUNCheckedException(String code, Throwable e) {
		super(YIXUNExceptionCode.getInMsg(code),e);
		this.code = code;
	}

	public YXUNCheckedException(String code, String message) {
		super(message);
		this.code = code;
	}

	public YXUNCheckedException(String code, String message, Throwable e) {
		super(message, e);
		this.code = code;
	}

	public String getCode() {
		return code;
	}
	public YXUNCheckedException(ExceptionCodeEnum mcode, Throwable e) {
		super(mcode.getDesin(),e);
		this.code = mcode.getCode();
	}
}
